const {
  vehicleGetById
} = require('../../../api/api')
Page({
  /**
   * 页面的初始数据
   */
  data: {
    bottomLift: getApp().globalData.bottomLift,
    id: null,
    info: {}
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if (options.id) {
      this.setData({
        id: options.id
      })
      this.loadData()
    }
  },
  async loadData() {
    const {
      id
    } = this.data
    const params = {
      id
    }
    const result = await vehicleGetById(params)
    this.setData({
      info: result
    })
  },
  cancel() {
    setTimeout(() => {
      wx.navigateBack({
        delta: 1,
      })
    }, 500);
    const pages=getCurrentPages()
    const prevPage=pages[pages.length-2]
    prevPage.setData({
      list:[],
      page:1
    })
    prevPage.onLoad()
  }
})